function init() {
	//fillTable();
	lock();
	$("#icWaterAccount").css("background-color", "#ffffff");
	$("#icWaterAccount").attr("readonly", "");
	$("#cha").attr("value", "查找");
}
function addMsg() {
	var date = new Date();
	var num = "" + date.getYear() + date.getMonth() + date.getDay()
			+ date.getHours() + date.getMinutes() + date.getMilliseconds();
	inputAddEdit();
	dwr.util.setValue("icWaterAccount", num);
	$("#icWaterAccount").css("background-color", "#EEFFFF");
	$("#icWaterAccount").attr("readonly", "readonly");

}
var id = null;
var number = null;
function fillTable(water) {//现实列表
	pub.find(water, function(userList) {
		if (userList == null) {
			alert("没有此流水号的对应信息！");
			return;
		}
		dwr.util.setValue("ipId", userList.ipId);
		dwr.util.setValue("icWaterAccount", userList.icWaterAccount);
		dwr.util.setValue("icApplyAccount", userList.icApplyAccount);
		dwr.util.setValue("icNumId", userList.icNumId);
		dwr.util.setValue("icCustomerName", userList.icCustomerName);
		dwr.util.setValue("icDeliveryDate", userList.icDeliveryDate);
		dwr.util.setValue("icOpenCheckDate", userList.icOpenCheckDate);
		dwr.util.setValue("idAffixName", userList.idAffixName);
		dwr.util.setValue("icDestination", userList.icDestination);
		dwr.util.setValue("icContractNumber", userList.icContractNumber);

		dwr.util.setValue("icLicenseNumber", userList.icLicenseNumber);
		dwr.util.setValue("icInvoiceNumber", userList.icInvoiceNumber);
		dwr.util.setValue("idDeviceName", userList.idDeviceName);
		dwr.util.setValue("ichId", userList.ichId);
		dwr.util.setValue("ifDistributedFare", userList.ifDistributedFare);
		dwr.util.setValue("idAffixNumber", userList.idAffixNumber);
		dwr.util.setValue("icDistance", userList.icDistance);
		dwr.util.setValue("idSize", userList.idSize);
		dwr.util.setValue("idDevicNumber", userList.idDevicNumber);
		dwr.util.setValue("icarNumId", userList.icarNumId);
		dwr.util.setValue("idWeight", userList.idWeight);
		dwr.util.setValue("ieNumId", userList.ieNumId);
		dwr.util.setValue("irOpenAddress", userList.irOpenAddress);
		dwr.util.setValue("icNote", userList.icNote);
		dwr.util.setValue("iuNumber", userList.iuNumber);
		id = userList.ipId;
		number = userList.icWaterAccount;
	});
}
function waterNum() {
	var water = dwr.util.getValue("icWaterAccount");
	if (water.length > 0) {
		fillTable(water);
	} else {
		alert("流水号不能为空！");
		return;
	}

}
function deleteClicked() {//删除
	if (id == null) {
		return;
	}

	if (confirm("你确定要删除 " + number + " 的信息 ?")) {
		dwr.engine.beginBatch();
		pub.del(id);
		clear();
		dwr.engine.endBatch();
		id = null;
		number = null;
	}
}
function saveUser() {//添加user

	var user = {
		ipId : null,//
		icWaterAccount : null,// 流水账号 0
		icarNumId : null,// 车辆编号0
		icLicenseNumber : null,// 车牌号码0

		ieNumId : null,// 运费0

		icNumId : null,// 客户编号0
		ichId : null,// 订单编号0
		icApplyAccount : null,// 申请账号0
		icContractNumber : null,// 合同编号0

		icInvoiceNumber : null,// 发票号码0
		icDeliveryDate : null,// 出货日期0
		icOpenCheckDate : null,// 开票日期0
		icDistance : null,// 距离0
		icOrderCheck : null,// 托运订单
		icNote : null,// 备注0
		icCustomerName : null,// 客户名称0
		icDestination : null,// 目的地点0
		idDeviceName : null,// 主件名称0
		idAffixName : null,// 附件名称0
		idDevicNumber : null,// 主件数量0
		idAffixNumber : null,// 附件数量0
		idWeight : null,// 重量0
		idSize : null,// 体积0

		ifDistributedFare : null,// 分送费用0

		irOpenAddress : null,// 出发地址0
		iuNumber : null

	};
	dwr.util.getValues(user);
	if (user.icApplyAccount <= 0 || user.icNumId <= 0) {
		alert("请输入信息！");
		return;
	}
	dwr.engine.beginBatch();

	if (user.ipId > 0) {
		pub.updata(user);
	} else {
		pub.save(user);
	}

	dwr.engine.endBatch();
	inputSaveEdit();
	clear();
	init();
	id = null;
}